(function flexible(window, document) {
  var docEl = document.documentElement
  var dpr = window.devicePixelRatio || 1

  // adjust body font size
  function setBodyFontSize() {
    if (document.body) {
      document.body.style.fontSize = (12 * dpr) + 'px'
    }
    else {
      document.addEventListener('DOMContentLoaded', setBodyFontSize)
    }
  }
  setBodyFontSize();

  // set 1rem = viewWidth / 10
  function setRemUnit() {
    var rem = docEl.clientWidth / 10
    docEl.style.fontSize = rem + 'px'
  }

  setRemUnit()

  // reset rem unit on page resize
  window.addEventListener('resize', setRemUnit)
  window.addEventListener('pageshow', function (e) {
    if (e.persisted) {
      setRemUnit()
    }
  })

  // detect 0.5px supports
  if (dpr >= 2) {
    var fakeBody = document.createElement('body')
    var testElement = document.createElement('div')
    testElement.style.border = '.5px solid transparent'
    fakeBody.appendChild(testElement)
    docEl.appendChild(fakeBody)
    if (testElement.offsetHeight === 1) {
      docEl.classList.add('hairlines')
    }
    docEl.removeChild(fakeBody)
  }
}(window, document));



go_top(2000);
function go_top(num) {
  setTimeout(function () {
    var y = Math.ceil(window.scrollY)
    var top = document.createElement('div');
    top.innerHTML = `<div class="mu-button-wrapper"><div class="mu-ripple-wrapper"></div><i class=" mu-icon  material-icons" style="user-select: none;">arrow_upward</i></div>`;
    top.className = 'top mu-paper demo-paper mu-paper-circle mu-paper-round mu-elevation-5';
    top.style = `position: fixed;
    bottom: 10px;
    right: 10px;
    width: 0px;
    height: 0px;
    color: #fff;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    overflow:hidden;
    opacity: 0;`;
    setTimeout(function () {
      document.querySelectorAll('body')[0].appendChild(top);
      setTimeout(function () {
        var top = document.querySelectorAll('.top')[0];
        if (y > 300) {
          top.style.width = "50px";
          top.style.height = "50px";
          top.style.opacity = "1";
        };
        if (y < 300) {
          top.style.width = "0px";
          top.style.height = "0px";
          top.style.opacity = "0";
        };
      }, 100);
    }, 500);
    window.onscroll = function () {
      var y = Math.ceil(window.scrollY);
      var top = document.querySelectorAll('.top')[0];
      var flag = true;
      if (y > 300 && flag) {
        top.style.width = "50px";
        top.style.height = "50px";
        top.style.opacity = "1";
      } else {
        flag = !flag;
      };
      if (y < 300 && !flag) {
        top.style.width = "0px";
        top.style.height = "0px";
        top.style.opacity = "0";
      } else {
        flag = !flag;
      };

      top.addEventListener('click', function () {
        window.scrollTo(0, 0);
      }, false);
    };
  }, num);
};
//显示返回顶部





var $ = function $(obj) {
  var arr = ['number', '#', '.', 'string'];
  if (typeof obj != arr[0]) {

    if (obj.includes(arr[1])) {
      return (document.querySelector(obj));
    }; //查询id

    if (obj.includes(arr[2])) {
      var dom = document.querySelectorAll(obj);
      var len = dom.length;
      if (len === 1 && len) {
        return dom[0];
      } else {
        return dom;
      };
    }; //查询class

    if (typeof obj == arr[3]) {
      var dom = document.querySelectorAll(obj);
      var len = dom.length;
      if (len === 1 && len) {
        return dom[0];
      } else {
        return dom;
      };
    } else {
      console.log(new Error("请检查是否存在该tag"));
      return false;
    }; //查询tag

  } else {
    console.log(new Error("请传入id,class或标签"));
    return false;
  };
};

var img_null = './assets/image/null.jpg';
